package com.lancoo.znbkxx.teacher.ui.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import com.lancoo.znbkxx.teacher.R
import kotlinx.android.synthetic.main.aibk_dialog_explain.*

/**
 * auther: 王国龙
 *  Date：2020.06.28
 * describe:认知诊断报告说明性弹窗
 */
class DialogExplain(
        context: Context?,
        val explainContent:String
) : Dialog(context!!, R.style.CustomDialog) {
    /**
     * 提交按钮
     */
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.aibk_dialog_explain)
        window!!.setGravity(Gravity.CENTER) //设置弹窗右对齐
        window!!.setWindowAnimations(R.style.MyDialogScale) //设置动画效果

        //按空白处不能取消动画
        setCanceledOnTouchOutside(false)
        //初始化界面数据
        refreshView()
    }

    /**
     * 初始化界面控件的显示数据
     */
    private fun refreshView() {

        //说明内容
        TvMessage.text = explainContent

        //确定按钮
        BtnSure.setOnClickListener {
            dismiss()
        }
    }
}